package com.param_validate_demo.model;

import com.param_validate_demo.annotation.AgeValidate;
import com.param_validate_demo.annotation.EnumValidate;
import com.param_validate_demo.enums.GenderEnum;
import com.param_validate_demo.enums.RoleEnum;
import com.param_validate_demo.groups.Insert;
import com.param_validate_demo.groups.Query;
import com.param_validate_demo.groups.Update;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.math.BigInteger;
import java.util.List;

@Data
@AgeValidate(groups = {Insert.class, Update.class})
public class User {
    private BigInteger id;
    @NotNull(groups = {Insert.class, Update.class, Query.class},message = "name 不能为空")
    private String name;
    private int age;
    private String address;
    private String phone;
    private String email;

    @EnumValidate(enumClass = GenderEnum.class, groups = {Insert.class, Update.class})
    private String gender;

    @EnumValidate(enumClass = RoleEnum.class, message = "入参roles中存在值不在枚举RoleEnum中", groups = {Insert.class, Update.class})
    private List<String> roles;
}
